package com.ssm.apollo;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.TypeReference;
import okhttp3.*;

import java.io.IOException;
import java.util.List;
import java.util.Map;
import java.util.concurrent.TimeUnit;

public class ApolloNameSapceTool {

    public static void main(String[] args) {

        // https://apollo-portal.global-base.tc-jp1.huobiapps.com/apps/search?query=swap-&page=0&size=100
        String strJson = "[{\"name\":\"huobi-hswap-app\",\"appId\":\"huobi-hswap-app\",\"orgId\":\"blockchain-app-dev\",\"orgName\":\"区块链应用研发组\",\"ownerName\":\"zhangchunhui\",\"ownerEmail\":\"zhangchunhui@huobi.com\",\"id\":311,\"isDeleted\":false,\"dataChangeCreatedBy\":\"zhangchunhui\",\"dataChangeCreatedTime\":\"2021-07-02T01:21:40.000+0800\",\"dataChangeLastModifiedBy\":\"zhangchunhui\",\"dataChangeLastModifiedTime\":\"2021-07-02T01:21:40.000+0800\"},{\"name\":\"hgswap管理系统\",\"appId\":\"hgswap-mgt\",\"orgId\":\"ex-dev\",\"orgName\":\"云服务研发组\",\"ownerName\":\"mufengquan\",\"ownerEmail\":\"mufengquan@huobi.com\",\"id\":317,\"isDeleted\":false,\"dataChangeCreatedBy\":\"mufengquan\",\"dataChangeCreatedTime\":\"2021-07-12T17:14:21.000+0800\",\"dataChangeLastModifiedBy\":\"mufengquan\",\"dataChangeLastModifiedTime\":\"2021-07-12T17:14:21.000+0800\"},{\"name\":\"iswap-mgt-service\",\"appId\":\"iswap-mgt-service\",\"orgId\":\"ex-dev\",\"orgName\":\"云服务研发组\",\"ownerName\":\"mufengquan\",\"ownerEmail\":\"mufengquan@huobi.com\",\"id\":319,\"isDeleted\":false,\"dataChangeCreatedBy\":\"mufengquan\",\"dataChangeCreatedTime\":\"2021-07-15T20:03:23.000+0800\",\"dataChangeLastModifiedBy\":\"mufengquan\",\"dataChangeLastModifiedTime\":\"2021-07-15T20:03:23.000+0800\"},{\"name\":\"hgswap-mgt-service\",\"appId\":\"hgswap-mgt-service\",\"orgId\":\"ex-dev\",\"orgName\":\"云服务研发组\",\"ownerName\":\"mufengquan\",\"ownerEmail\":\"mufengquan@huobi.com\",\"id\":320,\"isDeleted\":false,\"dataChangeCreatedBy\":\"mufengquan\",\"dataChangeCreatedTime\":\"2021-07-16T12:49:31.000+0800\",\"dataChangeLastModifiedBy\":\"mufengquan\",\"dataChangeLastModifiedTime\":\"2021-07-16T12:49:31.000+0800\"},{\"name\":\"iswap-relayer-v3\",\"appId\":\"iswap-relayer-v3\",\"orgId\":\"ex-dev\",\"orgName\":\"云服务研发组\",\"ownerName\":\"mufengquan\",\"ownerEmail\":\"mufengquan@huobi.com\",\"id\":413,\"isDeleted\":false,\"dataChangeCreatedBy\":\"mufengquan\",\"dataChangeCreatedTime\":\"2021-09-26T23:06:46.000+0800\",\"dataChangeLastModifiedBy\":\"mufengquan\",\"dataChangeLastModifiedTime\":\"2021-09-26T23:06:46.000+0800\"},{\"name\":\"iswap-auto-node\",\"appId\":\"iswap-auto-node\",\"orgId\":\"ex-dev\",\"orgName\":\"云服务研发组\",\"ownerName\":\"gaoyuqiao\",\"ownerEmail\":\"gaoyuqiao@huobi.com\",\"id\":460,\"isDeleted\":false,\"dataChangeCreatedBy\":\"gaoyuqiao\",\"dataChangeCreatedTime\":\"2021-11-11T10:21:06.000+0800\",\"dataChangeLastModifiedBy\":\"gaoyuqiao\",\"dataChangeLastModifiedTime\":\"2021-11-11T10:21:06.000+0800\"},{\"name\":\"iswap-api\",\"appId\":\"iswap-api\",\"orgId\":\"ex-dev\",\"orgName\":\"云服务研发组\",\"ownerName\":\"zhangsong01\",\"ownerEmail\":\"zhangsong01@huobi.com\",\"id\":465,\"isDeleted\":false,\"dataChangeCreatedBy\":\"zhangsong01\",\"dataChangeCreatedTime\":\"2021-11-14T18:11:31.000+0800\",\"dataChangeLastModifiedBy\":\"zhangsong01\",\"dataChangeLastModifiedTime\":\"2021-11-14T18:11:31.000+0800\"},{\"name\":\"linear-swap-api\",\"appId\":\"linear-swap-api\",\"orgId\":\"R\\u0026D\",\"orgName\":\"合约研发部\",\"ownerName\":\"tangxiangqi\",\"ownerEmail\":\"tangxiangqi@huobi.com\",\"id\":746,\"isDeleted\":false,\"dataChangeCreatedBy\":\"tangxiangqi\",\"dataChangeCreatedTime\":\"2022-06-01T23:08:59.000+0800\",\"dataChangeLastModifiedBy\":\"tangxiangqi\",\"dataChangeLastModifiedTime\":\"2022-06-01T23:08:59.000+0800\"},{\"name\":\"linear-swap-inter\",\"appId\":\"linear-swap-inter\",\"orgId\":\"R\\u0026D\",\"orgName\":\"合约研发部\",\"ownerName\":\"tangxiangqi\",\"ownerEmail\":\"tangxiangqi@huobi.com\",\"id\":749,\"isDeleted\":false,\"dataChangeCreatedBy\":\"tangxiangqi\",\"dataChangeCreatedTime\":\"2022-06-01T23:28:20.000+0800\",\"dataChangeLastModifiedBy\":\"tangxiangqi\",\"dataChangeLastModifiedTime\":\"2022-06-01T23:28:20.000+0800\"},{\"name\":\"linear-swap-job\",\"appId\":\"linear-swap-job\",\"orgId\":\"R\\u0026D\",\"orgName\":\"合约研发部\",\"ownerName\":\"tangxiangqi\",\"ownerEmail\":\"tangxiangqi@huobi.com\",\"id\":750,\"isDeleted\":false,\"dataChangeCreatedBy\":\"tangxiangqi\",\"dataChangeCreatedTime\":\"2022-06-01T23:29:44.000+0800\",\"dataChangeLastModifiedBy\":\"tangxiangqi\",\"dataChangeLastModifiedTime\":\"2022-06-01T23:29:44.000+0800\"},{\"name\":\"linear-swap-notification\",\"appId\":\"linear-swap-notification\",\"orgId\":\"R\\u0026D\",\"orgName\":\"合约研发部\",\"ownerName\":\"tangxiangqi\",\"ownerEmail\":\"tangxiangqi@huobi.com\",\"id\":751,\"isDeleted\":false,\"dataChangeCreatedBy\":\"tangxiangqi\",\"dataChangeCreatedTime\":\"2022-06-01T23:30:42.000+0800\",\"dataChangeLastModifiedBy\":\"tangxiangqi\",\"dataChangeLastModifiedTime\":\"2022-06-01T23:30:42.000+0800\"},{\"name\":\"linear-swap-order\",\"appId\":\"linear-swap-order\",\"orgId\":\"R\\u0026D\",\"orgName\":\"合约研发部\",\"ownerName\":\"tangxiangqi\",\"ownerEmail\":\"tangxiangqi@huobi.com\",\"id\":752,\"isDeleted\":false,\"dataChangeCreatedBy\":\"tangxiangqi\",\"dataChangeCreatedTime\":\"2022-06-01T23:31:50.000+0800\",\"dataChangeLastModifiedBy\":\"tangxiangqi\",\"dataChangeLastModifiedTime\":\"2022-06-01T23:31:50.000+0800\"},{\"name\":\"linear-swap-storm\",\"appId\":\"linear-swap-storm\",\"orgId\":\"R\\u0026D\",\"orgName\":\"合约研发部\",\"ownerName\":\"tangxiangqi\",\"ownerEmail\":\"tangxiangqi@huobi.com\",\"id\":753,\"isDeleted\":false,\"dataChangeCreatedBy\":\"tangxiangqi\",\"dataChangeCreatedTime\":\"2022-06-01T23:32:58.000+0800\",\"dataChangeLastModifiedBy\":\"tangxiangqi\",\"dataChangeLastModifiedTime\":\"2022-06-01T23:32:58.000+0800\"},{\"name\":\"linear-swap-grid\",\"appId\":\"linear-swap-grid\",\"orgId\":\"R\\u0026D\",\"orgName\":\"合约研发部\",\"ownerName\":\"tangxiangqi\",\"ownerEmail\":\"tangxiangqi@huobi.com\",\"id\":754,\"isDeleted\":false,\"dataChangeCreatedBy\":\"tangxiangqi\",\"dataChangeCreatedTime\":\"2022-06-01T23:34:18.000+0800\",\"dataChangeLastModifiedBy\":\"tangxiangqi\",\"dataChangeLastModifiedTime\":\"2022-06-01T23:34:18.000+0800\"},{\"name\":\"linear-swap-persist\",\"appId\":\"linear-swap-persist\",\"orgId\":\"R\\u0026D\",\"orgName\":\"合约研发部\",\"ownerName\":\"tangxiangqi\",\"ownerEmail\":\"tangxiangqi@huobi.com\",\"id\":755,\"isDeleted\":false,\"dataChangeCreatedBy\":\"tangxiangqi\",\"dataChangeCreatedTime\":\"2022-06-01T23:35:16.000+0800\",\"dataChangeLastModifiedBy\":\"tangxiangqi\",\"dataChangeLastModifiedTime\":\"2022-06-01T23:35:16.000+0800\"},{\"name\":\"linear-swap-manager\",\"appId\":\"linear-swap-manager\",\"orgId\":\"R\\u0026D\",\"orgName\":\"合约研发部\",\"ownerName\":\"tangxiangqi\",\"ownerEmail\":\"tangxiangqi@huobi.com\",\"id\":756,\"isDeleted\":false,\"dataChangeCreatedBy\":\"tangxiangqi\",\"dataChangeCreatedTime\":\"2022-06-01T23:36:15.000+0800\",\"dataChangeLastModifiedBy\":\"tangxiangqi\",\"dataChangeLastModifiedTime\":\"2022-06-01T23:36:15.000+0800\"},{\"name\":\"linear-swap-risk\",\"appId\":\"linear-swap-risk\",\"orgId\":\"R\\u0026D\",\"orgName\":\"合约研发部\",\"ownerName\":\"tangxiangqi\",\"ownerEmail\":\"tangxiangqi@huobi.com\",\"id\":757,\"isDeleted\":false,\"dataChangeCreatedBy\":\"tangxiangqi\",\"dataChangeCreatedTime\":\"2022-06-01T23:37:05.000+0800\",\"dataChangeLastModifiedBy\":\"tangxiangqi\",\"dataChangeLastModifiedTime\":\"2022-06-01T23:37:05.000+0800\"},{\"name\":\"linear-swap-risk-stats\",\"appId\":\"linear-swap-risk-stats\",\"orgId\":\"R\\u0026D\",\"orgName\":\"合约研发部\",\"ownerName\":\"tangxiangqi\",\"ownerEmail\":\"tangxiangqi@huobi.com\",\"id\":758,\"isDeleted\":false,\"dataChangeCreatedBy\":\"tangxiangqi\",\"dataChangeCreatedTime\":\"2022-06-01T23:38:02.000+0800\",\"dataChangeLastModifiedBy\":\"tangxiangqi\",\"dataChangeLastModifiedTime\":\"2022-06-01T23:38:02.000+0800\"},{\"name\":\"linear-swap-settlement\",\"appId\":\"linear-swap-settlement\",\"orgId\":\"R\\u0026D\",\"orgName\":\"合约研发部\",\"ownerName\":\"tangxiangqi\",\"ownerEmail\":\"tangxiangqi@huobi.com\",\"id\":759,\"isDeleted\":false,\"dataChangeCreatedBy\":\"tangxiangqi\",\"dataChangeCreatedTime\":\"2022-06-01T23:38:53.000+0800\",\"dataChangeLastModifiedBy\":\"tangxiangqi\",\"dataChangeLastModifiedTime\":\"2022-06-01T23:38:53.000+0800\"},{\"name\":\"linear-swap-dbsync\",\"appId\":\"linear-swap-dbsync\",\"orgId\":\"R\\u0026D\",\"orgName\":\"合约研发部\",\"ownerName\":\"tangxiangqi\",\"ownerEmail\":\"tangxiangqi@huobi.com\",\"id\":760,\"isDeleted\":false,\"dataChangeCreatedBy\":\"tangxiangqi\",\"dataChangeCreatedTime\":\"2022-06-01T23:39:41.000+0800\",\"dataChangeLastModifiedBy\":\"tangxiangqi\",\"dataChangeLastModifiedTime\":\"2022-06-01T23:39:41.000+0800\"},{\"name\":\"linear-swap-task\",\"appId\":\"linear-swap-task\",\"orgId\":\"R\\u0026D\",\"orgName\":\"合约研发部\",\"ownerName\":\"tangxiangqi\",\"ownerEmail\":\"tangxiangqi@huobi.com\",\"id\":761,\"isDeleted\":false,\"dataChangeCreatedBy\":\"tangxiangqi\",\"dataChangeCreatedTime\":\"2022-06-01T23:41:15.000+0800\",\"dataChangeLastModifiedBy\":\"tangxiangqi\",\"dataChangeLastModifiedTime\":\"2022-06-01T23:41:15.000+0800\"},{\"name\":\"linear-swap-trigger\",\"appId\":\"linear-swap-trigger\",\"orgId\":\"R\\u0026D\",\"orgName\":\"合约研发部\",\"ownerName\":\"tangxiangqi\",\"ownerEmail\":\"tangxiangqi@huobi.com\",\"id\":762,\"isDeleted\":false,\"dataChangeCreatedBy\":\"tangxiangqi\",\"dataChangeCreatedTime\":\"2022-06-01T23:42:02.000+0800\",\"dataChangeLastModifiedBy\":\"tangxiangqi\",\"dataChangeLastModifiedTime\":\"2022-06-01T23:42:02.000+0800\"},{\"name\":\"linear-swap-sequence\",\"appId\":\"linear-swap-sequence\",\"orgId\":\"R\\u0026D\",\"orgName\":\"合约研发部\",\"ownerName\":\"tangxiangqi\",\"ownerEmail\":\"tangxiangqi@huobi.com\",\"id\":800,\"isDeleted\":false,\"dataChangeCreatedBy\":\"tangxiangqi\",\"dataChangeCreatedTime\":\"2022-06-14T13:53:04.000+0800\",\"dataChangeLastModifiedBy\":\"tangxiangqi\",\"dataChangeLastModifiedTime\":\"2022-06-14T13:53:04.000+0800\"},{\"name\":\"swap-notification(反向永续资产推送)\",\"appId\":\"swap-notification\",\"orgId\":\"exchange\",\"orgName\":\"交易组\",\"ownerName\":\"renyi\",\"ownerEmail\":\"renyi@hnnewsoft.com\",\"id\":810,\"isDeleted\":false,\"dataChangeCreatedBy\":\"renyi\",\"dataChangeCreatedTime\":\"2022-06-16T17:42:19.000+0800\",\"dataChangeLastModifiedBy\":\"renyi\",\"dataChangeLastModifiedTime\":\"2022-06-16T17:42:19.000+0800\"},{\"name\":\"swap-manager\",\"appId\":\"swap-manager\",\"orgId\":\"R\\u0026D\",\"orgName\":\"合约研发部\",\"ownerName\":\"zhengshaohong\",\"ownerEmail\":\"zhengshaohong@hnnewsoft.com\",\"id\":836,\"isDeleted\":false,\"dataChangeCreatedBy\":\"zhengshaohong\",\"dataChangeCreatedTime\":\"2022-06-23T14:30:15.000+0800\",\"dataChangeLastModifiedBy\":\"zhengshaohong\",\"dataChangeLastModifiedTime\":\"2022-06-23T14:30:15.000+0800\"},{\"name\":\"swap-risk\",\"appId\":\"swap-risk\",\"orgId\":\"R\\u0026D\",\"orgName\":\"合约研发部\",\"ownerName\":\"zhengshaohong\",\"ownerEmail\":\"zhengshaohong@hnnewsoft.com\",\"id\":837,\"isDeleted\":false,\"dataChangeCreatedBy\":\"zhengshaohong\",\"dataChangeCreatedTime\":\"2022-06-23T14:40:38.000+0800\",\"dataChangeLastModifiedBy\":\"zhengshaohong\",\"dataChangeLastModifiedTime\":\"2022-06-23T14:40:38.000+0800\"},{\"name\":\"swap-job\",\"appId\":\"swap-job\",\"orgId\":\"R\\u0026D\",\"orgName\":\"合约研发部\",\"ownerName\":\"zhengshaohong\",\"ownerEmail\":\"zhengshaohong@hnnewsoft.com\",\"id\":838,\"isDeleted\":false,\"dataChangeCreatedBy\":\"zhengshaohong\",\"dataChangeCreatedTime\":\"2022-06-23T14:51:59.000+0800\",\"dataChangeLastModifiedBy\":\"zhengshaohong\",\"dataChangeLastModifiedTime\":\"2022-06-23T14:51:59.000+0800\"},{\"name\":\"swap-api\",\"appId\":\"swap-api\",\"orgId\":\"R\\u0026D\",\"orgName\":\"合约研发部\",\"ownerName\":\"zhengshaohong\",\"ownerEmail\":\"zhengshaohong@hnnewsoft.com\",\"id\":839,\"isDeleted\":false,\"dataChangeCreatedBy\":\"zhengshaohong\",\"dataChangeCreatedTime\":\"2022-06-23T14:56:13.000+0800\",\"dataChangeLastModifiedBy\":\"zhengshaohong\",\"dataChangeLastModifiedTime\":\"2022-06-23T14:56:13.000+0800\"},{\"name\":\"swap-task\",\"appId\":\"swap-task\",\"orgId\":\"R\\u0026D\",\"orgName\":\"合约研发部\",\"ownerName\":\"zhengshaohong\",\"ownerEmail\":\"zhengshaohong@hnnewsoft.com\",\"id\":840,\"isDeleted\":false,\"dataChangeCreatedBy\":\"zhengshaohong\",\"dataChangeCreatedTime\":\"2022-06-23T15:06:57.000+0800\",\"dataChangeLastModifiedBy\":\"zhengshaohong\",\"dataChangeLastModifiedTime\":\"2022-06-23T15:06:57.000+0800\"},{\"name\":\"swap-inter\",\"appId\":\"swap-inter\",\"orgId\":\"R\\u0026D\",\"orgName\":\"合约研发部\",\"ownerName\":\"zhengshaohong\",\"ownerEmail\":\"zhengshaohong@hnnewsoft.com\",\"id\":841,\"isDeleted\":false,\"dataChangeCreatedBy\":\"zhengshaohong\",\"dataChangeCreatedTime\":\"2022-06-23T15:13:35.000+0800\",\"dataChangeLastModifiedBy\":\"zhengshaohong\",\"dataChangeLastModifiedTime\":\"2022-06-23T15:13:35.000+0800\"},{\"name\":\"swap-order\",\"appId\":\"swap-order\",\"orgId\":\"R\\u0026D\",\"orgName\":\"合约研发部\",\"ownerName\":\"zhengshaohong\",\"ownerEmail\":\"zhengshaohong@hnnewsoft.com\",\"id\":842,\"isDeleted\":false,\"dataChangeCreatedBy\":\"zhengshaohong\",\"dataChangeCreatedTime\":\"2022-06-23T15:14:13.000+0800\",\"dataChangeLastModifiedBy\":\"zhengshaohong\",\"dataChangeLastModifiedTime\":\"2022-06-23T15:14:13.000+0800\"},{\"name\":\"swap-settlement\",\"appId\":\"swap-settlement\",\"orgId\":\"R\\u0026D\",\"orgName\":\"合约研发部\",\"ownerName\":\"zhengshaohong\",\"ownerEmail\":\"zhengshaohong@hnnewsoft.com\",\"id\":843,\"isDeleted\":false,\"dataChangeCreatedBy\":\"zhengshaohong\",\"dataChangeCreatedTime\":\"2022-06-23T15:14:51.000+0800\",\"dataChangeLastModifiedBy\":\"zhengshaohong\",\"dataChangeLastModifiedTime\":\"2022-06-23T15:14:51.000+0800\"},{\"name\":\"swap-dbsync\",\"appId\":\"swap-dbsync\",\"orgId\":\"R\\u0026D\",\"orgName\":\"合约研发部\",\"ownerName\":\"zhengshaohong\",\"ownerEmail\":\"zhengshaohong@hnnewsoft.com\",\"id\":845,\"isDeleted\":false,\"dataChangeCreatedBy\":\"zhengshaohong\",\"dataChangeCreatedTime\":\"2022-06-23T17:08:06.000+0800\",\"dataChangeLastModifiedBy\":\"zhengshaohong\",\"dataChangeLastModifiedTime\":\"2022-06-23T17:08:06.000+0800\"},{\"name\":\"swap-sequence\",\"appId\":\"swap-sequence\",\"orgId\":\"R\\u0026D\",\"orgName\":\"合约研发部\",\"ownerName\":\"zhengshaohong\",\"ownerEmail\":\"zhengshaohong@hnnewsoft.com\",\"id\":846,\"isDeleted\":false,\"dataChangeCreatedBy\":\"zhengshaohong\",\"dataChangeCreatedTime\":\"2022-06-23T17:09:08.000+0800\",\"dataChangeLastModifiedBy\":\"zhengshaohong\",\"dataChangeLastModifiedTime\":\"2022-06-23T17:09:08.000+0800\"},{\"name\":\"swap-storm\",\"appId\":\"swap-storm\",\"orgId\":\"R\\u0026D\",\"orgName\":\"合约研发部\",\"ownerName\":\"zhengshaohong\",\"ownerEmail\":\"zhengshaohong@hnnewsoft.com\",\"id\":847,\"isDeleted\":false,\"dataChangeCreatedBy\":\"zhengshaohong\",\"dataChangeCreatedTime\":\"2022-06-23T17:10:27.000+0800\",\"dataChangeLastModifiedBy\":\"zhengshaohong\",\"dataChangeLastModifiedTime\":\"2022-06-23T17:10:27.000+0800\"},{\"name\":\"swap-trigger\",\"appId\":\"swap-trigger\",\"orgId\":\"R\\u0026D\",\"orgName\":\"合约研发部\",\"ownerName\":\"zhengshaohong\",\"ownerEmail\":\"zhengshaohong@hnnewsoft.com\",\"id\":848,\"isDeleted\":false,\"dataChangeCreatedBy\":\"zhengshaohong\",\"dataChangeCreatedTime\":\"2022-06-23T17:11:03.000+0800\",\"dataChangeLastModifiedBy\":\"zhengshaohong\",\"dataChangeLastModifiedTime\":\"2022-06-23T17:11:03.000+0800\"},{\"name\":\"futures-swap-common\",\"appId\":\"futures-swap-common\",\"orgId\":\"R\\u0026D\",\"orgName\":\"合约研发部\",\"ownerName\":\"zhengshaohong\",\"ownerEmail\":\"zhengshaohong@hnnewsoft.com\",\"id\":850,\"isDeleted\":false,\"dataChangeCreatedBy\":\"zhengshaohong\",\"dataChangeCreatedTime\":\"2022-06-23T21:15:15.000+0800\",\"dataChangeLastModifiedBy\":\"zhengshaohong\",\"dataChangeLastModifiedTime\":\"2022-06-23T21:15:15.000+0800\"},{\"name\":\"linear-swap-activity\",\"appId\":\"linear-swap-activity\",\"orgId\":\"R\\u0026D\",\"orgName\":\"合约研发部\",\"ownerName\":\"wangshuai04\",\"ownerEmail\":\"wangshuai04@global-hgroup.com\",\"id\":852,\"isDeleted\":false,\"dataChangeCreatedBy\":\"wangshuai04\",\"dataChangeCreatedTime\":\"2022-06-24T11:22:26.000+0800\",\"dataChangeLastModifiedBy\":\"wangshuai04\",\"dataChangeLastModifiedTime\":\"2022-06-24T11:22:26.000+0800\"},{\"name\":\"swap-phone\",\"appId\":\"swap-phone\",\"orgId\":\"R\\u0026D\",\"orgName\":\"合约研发部\",\"ownerName\":\"zhengshaohong\",\"ownerEmail\":\"zhengshaohong@hnnewsoft.com\",\"id\":853,\"isDeleted\":false,\"dataChangeCreatedBy\":\"zhengshaohong\",\"dataChangeCreatedTime\":\"2022-06-25T19:51:03.000+0800\",\"dataChangeLastModifiedBy\":\"zhengshaohong\",\"dataChangeLastModifiedTime\":\"2022-06-25T19:51:03.000+0800\"},{\"name\":\"swap-email\",\"appId\":\"swap-email\",\"orgId\":\"R\\u0026D\",\"orgName\":\"合约研发部\",\"ownerName\":\"zhengshaohong\",\"ownerEmail\":\"zhengshaohong@hnnewsoft.com\",\"id\":854,\"isDeleted\":false,\"dataChangeCreatedBy\":\"zhengshaohong\",\"dataChangeCreatedTime\":\"2022-06-25T19:52:49.000+0800\",\"dataChangeLastModifiedBy\":\"zhengshaohong\",\"dataChangeLastModifiedTime\":\"2022-06-25T19:52:49.000+0800\"},{\"name\":\"swap-sms\",\"appId\":\"swap-sms\",\"orgId\":\"R\\u0026D\",\"orgName\":\"合约研发部\",\"ownerName\":\"zhengshaohong\",\"ownerEmail\":\"zhengshaohong@hnnewsoft.com\",\"id\":855,\"isDeleted\":false,\"dataChangeCreatedBy\":\"zhengshaohong\",\"dataChangeCreatedTime\":\"2022-06-25T19:53:09.000+0800\",\"dataChangeLastModifiedBy\":\"zhengshaohong\",\"dataChangeLastModifiedTime\":\"2022-06-25T19:53:09.000+0800\"}]";
        String[] namespaces = new String[] {"futures-swap.awssecret","futures-swap.datadog","futures-swap.mysql","futures-swap.rabbitmq","futures-swap.redis","futures-swap.zookeeper","futures-swap.es","futures-swap.kafka"};

        List<Map<String, String>> maps = JSON.parseObject(strJson, new TypeReference<List<Map<String, String>>>() {
        });

        for (String namespace : namespaces) {
            for (Map<String, String> m : maps) {
                String ownerName = m.get("ownerName");
                String appId = m.get("appId");

                if ("zhengshaohong".equals(ownerName) && appId.startsWith("swap-")) {
                    System.out.println("start appId:" + appId + "add public namespace :" + namespace + ".");
                    addNamespace(appId, namespace);
                    System.out.println("successful appId:" + appId + "add public namespace :" + namespace + ".");
                    try {
                        TimeUnit.SECONDS.sleep(1);
                    } catch (InterruptedException e) {
                        throw new RuntimeException(e);
                    }
                }
            }
        }


    }

    public static void addNamespace(String appId, String namespaceName) {
        OkHttpClient client = new OkHttpClient().newBuilder()
                .build();
        MediaType mediaType = MediaType.parse("application/json");
        RequestBody body = RequestBody.create(mediaType, "[{\"env\":\"FAT\",\"namespace\":{\"appId\":\""+ appId +"\",\"clusterName\":\"default\",\"namespaceName\":\""+namespaceName+"\"}}]");
        Request request = new Request.Builder()
                .url("http://apollo-portal.global-base.tc-jp1.huobiapps.com/apps/swap-risk/namespaces")
                .method("POST", body)
                .addHeader("Cookie", " _fbp=fb.1.1655460921532.188605196; NG_TRANSLATE_LANG_KEY=zh-CN; CABBAGE=65f97f1122e18a420a627a31c76060b6; _gid=GA1.2.1976907747.1656255177; sensorsdata2015jssdkcross=%7B%22distinct_id%22%3A%2255A4001FE8156C90094256A224B0E55E426E2D1158FFC0002681338143C44AF5%22%2C%22first_id%22%3A%221817128fe03903-0a3df218050e8a-50500c15-3686400-1817128fe0418d7%22%2C%22props%22%3A%7B%22%24latest_traffic_source_type%22%3A%22%E7%9B%B4%E6%8E%A5%E6%B5%81%E9%87%8F%22%2C%22%24latest_search_keyword%22%3A%22%E6%9C%AA%E5%8F%96%E5%88%B0%E5%80%BC_%E7%9B%B4%E6%8E%A5%E6%89%93%E5%BC%80%22%2C%22%24latest_referrer%22%3A%22%22%7D%2C%22%24device_id%22%3A%221817128fe03903-0a3df218050e8a-50500c15-3686400-1817128fe0418d7%22%7D; _ga_J76R0D6G87=GS1.1.1656314271.21.1.1656314292.39; _ga=GA1.1.667981682.1655459463; _c_portal=415be332217abd251afd6e5a01dacfdb:1656317172509; _c=wNkhpG5xDIswVrocohltz2Y06VbnCdlU; memCacheAssertionID=7UjUCzDsGjkaN5ry; _ga_R8XL14RVYP=GS1.1.1656312984.43.1.1656320338.0")
                .addHeader("Host", " apollo-portal.global-base.tc-jp1.huobiapps.com")
                .addHeader("Origin", " http://apollo-portal.global-base.tc-jp1.huobiapps.com")
                .addHeader("Referer", " http://apollo-portal.global-base.tc-jp1.huobiapps.com/namespace.html?")
                .addHeader("User-Agent", " Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/103.0.0.0 Safari/537.36")
                .addHeader("Content-Type", "application/json")
                .build();
        try {
            Response response = client.newCall(request).execute();
            System.out.println(response);
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
}
